<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
<script>
    //当修改后的数组长度大于原数组
    var arr1 = ['a','b','c','d'];
    arr1.length = arr1.length * 2;
    console.log(arr1);

    //当修改后的数组长度小于原数组
    var arr2 = ['a','b','c','d'];
    arr2.length = arr2.length / 2;
    console.log(arr2);
</script>
</head>
<body>
    
</body>
</html>